<?php

namespace common\model;

use think\model\RelationModel;

class TenantRobotUserCertificateModel extends RelationModel
{
    //自动验证
    protected $_validate = [
//        ['app_key', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['app_key', '0,36', '', self::EXISTS_VALIDATE, 'length'],
//        ['app_secret', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['app_secret', '0,36', '', self::EXISTS_VALIDATE, 'length'],
        ['user_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['tenant_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
    ];

    // 自动完成
    protected $_auto = [
        ['app_key', 'auto_fill_md5_str', self::MODEL_INSERT, 'function'],
        ['app_secret', 'auto_fill_md5_str', self::MODEL_INSERT, 'function'],
        ['created', 'time', self::MODEL_INSERT, 'function'],
        ['updated', 'time', self::MODEL_BOTH, 'function'],
        ['uuid', 'create_uuid', self::MODEL_INSERT, 'function']
    ];
}
